package csv

import (
	utils "gosum/server/src/utitls"
)

type ConfigIcon struct {
	IconId int `json:"IconId"`
	Check  int `json:"Check"`
}

var (
	ConfigIconMap            map[int]*ConfigIcon
	ConfigIconMapByRoleIdMap map[int]*ConfigIcon
)

func init() {
	ConfigIconMap = make(map[int]*ConfigIcon)
	utils.GetCsvUtilMgr().LoadCsv("Icon", &ConfigIconMap)

	ConfigIconMapByRoleIdMap = make(map[int]*ConfigIcon)
	for _, v := range ConfigIconMap {
		ConfigIconMapByRoleIdMap[v.Check] = v
	}

	return
}

func GetIconConfig(iconId int) *ConfigIcon {
	return ConfigIconMap[iconId]
}

func GetIconConfigByRoleId(roleId int) *ConfigIcon {
	return ConfigIconMapByRoleIdMap[roleId]
}
